//
//  NguHanh.m
//  PhongThuyHuongNha
//
//  Created by Le Anh Tai on 10/10/13.
//  Copyright (c) 2013 Le Anh Tai. All rights reserved.
//

#import "NguHanh.h"

@implementation NguHanh

- (id)initWithHanh:(NSString *)hanh
{
    self = [super init];
    if (self)
    {
        _hanh = hanh;
    }
    
    return self;
}

- (NSString *)getHanhSinh
{
    NSInteger index = [NGU_HANH_TUONG_SINH indexOfObject:_hanh];
    if (index < 0)
    {
        return @"";
    }
    
    index--;
    index = index == -1?NGU_HANH_TUONG_SINH.count - 1:index;
    
    return [NGU_HANH_TUONG_SINH objectAtIndex:index];
}

- (NSString *)getSinhHanh
{
    NSInteger index = [NGU_HANH_TUONG_SINH indexOfObject:_hanh];
    if (index < 0)
    {
        return @"";
    }
    
    index++;
    index = index%NGU_HANH_TUONG_SINH.count;
    
    return [NGU_HANH_TUONG_SINH objectAtIndex:index];
}

- (NSString *)getHanhKhac
{
    NSInteger index = [NGU_HANH_TUONG_KHAC indexOfObject:_hanh];
    if (index < 0)
    {
        return @"";
    }
    
    index--;
    index = index == -1?NGU_HANH_TUONG_KHAC.count - 1:index;
    
    return [NGU_HANH_TUONG_KHAC objectAtIndex:index];
}

- (NSString *)getKhacHanh
{
    NSInteger index = [NGU_HANH_TUONG_KHAC indexOfObject:_hanh];
    if (index < 0)
    {
        return @"";
    }
    
    index++;
    index = index%NGU_HANH_TUONG_KHAC.count;
    
    return [NGU_HANH_TUONG_KHAC objectAtIndex:index];
}

@end
